import { get, post, del } from "@/utils/request";
import {
  type CompanyList,
  type CompanyListReturn,
  type accountAddParams,
  type addData,
} from "./type";

//列表
export const getCompanyList = (data: CompanyList) => {
  return get<CompanyList, CompanyListReturn>("/api/role/list", data);
};

// 添加
export const CompanyAdd = (data: accountAddParams) => {
  return post<accountAddParams, addData>("/api/role/add", data);
};
// 获取单条数据
export const CompanyGet = (id: number) => {
  return get<number, addData>(`/api/role/get/${id}`);
};
// 编辑
export const CompanyUpdate = (data: addData) => {
  return post<addData, addData>("/api/role/add", data);
};

//删除
export const delCompany = (id: number) => {
  return del<number, null>(`/api/role/delete/${id}`);
};
//批量删除
export const delMany = (ids: number[]) => {
  return post<number[], null>("/api/role/deleteAll", ids);
};
export { accountAddParams };
